package com.zhiy.com.estation.api;

import com.zhiy.com.estation.model.User;

import java.util.HashMap;

import io.reactivex.Flowable;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * All Resered by My Zong  @2016-2017
 * 存放所有的网络接口
 */
public interface ApiService {
    //请求登录
    @FormUrlEncoded
    @POST("Login/login")
    Flowable<ApiResult<User>> login(@Field("name") String name, @Field("password") String password);
    //请求注册
    @FormUrlEncoded
    @POST("Register/register")
    Flowable<ApiResult> regist(@Field("name")String name,@Field("password")String password);
    @FormUrlEncoded
    @POST("Find/findPass")
    Flowable<ApiResult<User>> findPass(@Field("name")String name);

    @Multipart
    @POST("Upload/upload")
    Flowable<ApiResult<String>> upload(@Part("userid")String userid,
                                     @Part("files\";filename=\"image.png\"")RequestBody requestBody);
    @FormUrlEncoded
    @POST("Upload/updata")
    Flowable<ApiResult<User>> updata(@FieldMap HashMap<String,String> map);

}

